]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
Make sure notification has all the content when it is expanded
authorMarina Zhurakhinskaya <marinaz@redhat.com>
Sun, 27 Mar 2011 18:57:34 +0000 (14:57 -0400)
committerMarina Zhurakhinskaya <marinaz@redhat.com>
Tue, 29 Mar 2011 02:40:17 +0000 (22:40 -0400)
Use Meta.later_add() with BEFORE_REDRAW rather than Mainloop.idle_add()
to add the banner body so that the notification body is reliably added
after the first frame is drawn. This is important for notifications that
are expanded right away, such as the summary notifications that
were not shown as banners because the user was in the Busy mode or was
interacting with the summary. Otherwise, these notifications were sometimes
shown with an ellipsized banner and were only getting full content when
they were done animating.

Only add expanded content and signal the change once. Previously, we
used to signal the change numerous times and processing this signal was
holding up processing other things, such as the user moving the mouse
away from the notification so that the notification collapses.

https://bugzilla.gnome.org/show_bug.cgi?id=645719

js/ui/messageTray.js

index f1244a5d0d88c26d739e249ebf57754092d8c9bc..fa965262cc1fbb415d46454e05ca8eda8355d0a5 100644 (file)
@@ -740,15 +740,22 @@ Notification.prototype = {
         // If the banner doesn't fully fit in the banner box, we possibly need to add the
         // banner to the body. We can't do that from here though since that will force a
         // relayout, so we add it to the main loop.
-        if (!bannerFits)
-            Mainloop.idle_add(Lang.bind(this,
-                                        function() {
+        if (!bannerFits && this._canExpandContent())
+            Meta.later_add(Meta.LaterType.BEFORE_REDRAW,
+                           Lang.bind(this,
+                                     function() {
+                                        if (this._canExpandContent()) {
                                             this._addBannerBody();
-                                            if (!this._titleFitsInBannerMode)
-                                                this._table.add_style_class_name('multi-line-notification');
+                                            this._table.add_style_class_name('multi-line-notification');
                                             this._updated();
-                                            return false;
-                                        }));
+                                        }
+                                        return false;
+                                     }));
+    },
+
+    _canExpandContent: function() {
+        return this._bannerBodyText ||
+               (!this._titleFitsInBannerMode && !this._table.has_style_class_name('multi-line-notification'));
     },
 
     _updated: function() {